package io.gitee.hchaojie.day01;

import org.junit.Test;

public class TestIfElse {

    // alt + enter
    // 求绝对值
    @Test
    public void testAbs() {
        int x = -1;

        int abs;

        if (x > 0) {
            abs = x;
        } else {
            abs = -x;
        }

        System.out.println(abs);
    }

    @Test
    public void testSwitch() {
        int day = 2;

        switch (day) {
            case 1:
                //
                System.out.println("星期一");
                break;

            case 2:
                System.out.println("星期二");
                break;
                //

            default:
                System.out.println("非法的天数");
                break;
        }
    }
    
    @Test
    public void testSwitch2() {
        int day = 6;
        switch (day) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                System.out.println("工作日");
                break;
                
            case 6:
            case 7:
                System.out.println("周末");
                break;
                
            default:
                System.out.println("非法的天数");
                break;
                
        }
    }
}
